﻿using Framework.EntityFramework;

namespace Framework.DataAccess
{
    public class DatabaseFactory : Disposable, IDatabaseFactory
    {

        #region IDatabaseFactory Members

        private DomainContext _db;

        public DomainContext Get()
        {
            return _db ?? (_db = new DomainContext());
        }

        protected override void DisposeCore()
        {
            if (_db != null)
            {
                _db.Dispose();
            }
        }

        #endregion
    }
}
